From 1d36a783486b2800b9dd543cf476013e19a765d9 Mon Sep 17 00:00:00 2001 From: "vhanquez@kneesa.uk.xensource.com" Date: Fri, 6 Jan 2006 22:07:04 +0000 Subject: [PATCH] test return value of kmalloc to prevent crash is the allocation fail. Signed-off-by: Vincent Hanquez --- linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_dev.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_dev.c b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_dev.c index 4f046c91da..a9aa6225bd 100644 --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_dev.c +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_dev.c @@ -140,6 +140,8 @@ static ssize_t xenbus_dev_write(struct file *filp, if (u->u.msg.type == XS_TRANSACTION_START) { trans = kmalloc(sizeof(*trans), GFP_KERNEL); + if (!trans) + return -ENOMEM; trans->handle = (struct xenbus_transaction *) simple_strtoul(reply, NULL, 0); list_add(&trans->list, &u->transactions); -- 2.30.2